namespace DotNetNuke.UI.Containers
{
    using DotNetNuke.Entities.Modules;
    using DotNetNuke.UI.Skins;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Diagnostics;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    /// -----------------------------------------------------------------------------
    /// Project	 : DotNetNuke
    /// Namespace: DotNetNuke.UI.Containers
    /// Class	 : Container
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// Container is the base for the Containers 
    /// </summary>
    /// <remarks>
    /// </remarks>
    /// <history>
    /// [cnurse]	07/04/2005	Documented
    /// </history>
    /// -----------------------------------------------------------------------------
    public class Container : UserControl
    {
       
        public Container()
        {
            base.Init += new EventHandler(this.Page_Init);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetPortalModuleBase gets the parent PortalModuleBase Control
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// [cnurse]	07/04/2005	Documented
        /// </history>
        /// -----------------------------------------------------------------------------
        public static PortalModuleBase GetPortalModuleBase(UserControl objControl)
        {
            Panel ctlPanel;
            PortalModuleBase objPortalModuleBase = null;
            if (objControl is SkinObjectBase)
            {
                ctlPanel = (Panel) objControl.Parent.FindControl("ModuleContent");
            }
            else
            {
                ctlPanel = (Panel) objControl.FindControl("ModuleContent");
            }
            if (ctlPanel != null)
            {
                try
                {
                    objPortalModuleBase = (PortalModuleBase) ctlPanel.Controls[0];
                }
                catch (Exception exception1)
                {
                    
                    
                }
            }
            if (objPortalModuleBase == null)
            {
                objPortalModuleBase = new PortalModuleBase();
                objPortalModuleBase.ModuleConfiguration = new DotNetNuke.Entities.Modules.ModuleInfo();
            }
            return objPortalModuleBase;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
        }

        private void Page_Init(object sender, EventArgs e)
        {
            this.InitializeComponent();
        }

        public string SkinPath
        {
            get
            {
                return (this.TemplateSourceDirectory + "/");
            }
        }
    }
}

